package mud.unit;

import mud.Combatable;

/** Action in which a unit attacks another unit */
public class AttackAction extends Action {

    /** the unit that is attacking */
    private final Character attacker;
    
    /** the units that are being attacked */
    private final Combatable[] targets;

    /**
     * Constructs a new AttackAction
     * @param attacker the unit that is attacking
     * @param targets the unit that is being attacked
     */
    public AttackAction(Character attacker, Combatable targets) {
        super(true);
        this.attacker = attacker;
        this.targets = new Combatable[]{targets};
    }

    @Override
    public void perform() {
        attacker.attack(targets[0]);
    }

    /**
     * @return the units that are being attacked
     */
    public Combatable[] getTargets() {
        return targets;
    }

    
}
